<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
[#include "../common/head.html"/]
[@head title="withdrawrecord.list.title"/]
<!-- BEGIN BODY -->
<body class="page-header-fixed page-sidebar-fixed page-quick-sidebar-over-content">
[#include "../common/top.html"/]
<!-- BEGIN CONTAINER -->
<div class="page-container">
	[#include "../common/left.html"/]
	[@menu menu="financial" submenu="withdraw-record"/]
	<!-- BEGIN CONTENT -->
	<div class="page-content-wrapper">
		<div class="page-content">
			<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
			<div id="ajax-modal" class="modal fade bs-modal" tabindex="-1"></div>
			<!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
			<!-- BEGIN PAGE CONTENT-->
			<div class="row">
				<div class="col-md-12">
					<!-- Begin: life time stats -->
					<div class="portlet">
						<div class="portlet-title">
							<div class="caption">
								<i class="fa fa-list-ul"></i>[@spring.message code="withdrawrecord.list.caption"/]
							</div>
						</div>
						<div class="portlet-body">
							<div class="table-container">
								<div class="table-actions-wrapper"></div>
								<table class="table table-striped table-bordered table-hover" id="datatable_withdrawrecords">
									<thead>
										<tr role="row" class="heading">
											<th rowspan="2" style="text-align: center; min-width: 180px;">[@spring.message code="datatable.column.operation"/]</th>
											<th colspan="3">[@spring.message code="withdrawrecord.list.datatable.column.baseInfo"/]</th>
											<th colspan="2">[@spring.message code="withdrawrecord.list.datatable.column.amountInfo"/]</th>
											<th colspan="4">[@spring.message code="withdrawrecord.list.datatable.column.payeeInfo"/]</th>
											<th colspan="3">[@spring.message code="withdrawrecord.list.datatable.column.payerInfo"/]</th>
											<th colspan="8">[@spring.message code="datatable.column.auditInfo"/]</th>
										</tr>
										<tr role="row" class="heading">
											<th style="min-width: 120px">[@spring.message code="withdrawrecord.list.datatable.column.userName"/]</th>
											<th>[@spring.message code="withdrawrecord.list.datatable.column.billNo"/]</th>
		                                    <th>[@spring.message code="withdrawrecord.list.datatable.column.status"/]</th>
											<th>[@spring.message code="withdrawrecord.list.datatable.column.amount"/]</th>
											<th>[@spring.message code="withdrawrecord.list.datatable.column.fee"/]</th>
		                                    <th>[@spring.message code="withdrawrecord.list.datatable.column.payeeBankName"/]</th>
		                                    <th>[@spring.message code="withdrawrecord.list.datatable.column.payeeBranchName"/]</th>
		                                    <th>[@spring.message code="withdrawrecord.list.datatable.column.payeeAccountName"/]</th>
		                                    <th>[@spring.message code="withdrawrecord.list.datatable.column.payeeAccountNo"/]</th>
		                                    <th>[@spring.message code="withdrawrecord.list.datatable.column.payerBankName"/]</th>
		                                    <th>[@spring.message code="withdrawrecord.list.datatable.column.payerAccountName"/]</th>
		                                    <th>[@spring.message code="withdrawrecord.list.datatable.column.payerAccountNo"/]</th>
		                                    <th>[@spring.message code="withdrawrecord.list.datatable.column.createdDate"/]</th>
		                                    <th>[@spring.message code="withdrawrecord.list.datatable.column.handleBeginTime"/]</th>
		                                    <th>[@spring.message code="withdrawrecord.list.datatable.column.handleEndTime"/]</th>
		                                    <th>[@spring.message code="withdrawrecord.list.datatable.column.handleTime"/]</th>
		                                    <th>[@spring.message code="withdrawrecord.list.datatable.column.totalTime"/]</th>
		                                    <th>[@spring.message code="datatable.column.lastModifiedBy"/]</th>
		                                    <th>[@spring.message code="datatable.column.lastModifiedDate"/]</th>
		                                    <th>[@spring.message code="withdrawrecord.list.datatable.column.remark"/]</th>
										</tr>
										<tr role="row" class="filter">
		                                	<td style="text-align: center;">
												<div class="margin-bottom-5">
													<button class="btn btn-sm yellow filter-submit margin-bottom"><i class="fa fa-search"></i> [@spring.message code="datatable.filter.search"/]</button>
												</div>
												<button class="btn btn-sm red filter-cancel"><i class="fa fa-times"></i> [@spring.message code="datatable.filter.reset"/]</button>
											</td>
											<td>
												<div class="margin-bottom-5">
													<input type="text" class="form-control form-filter input-sm" name="userName" value="${RequestParameters["userName"]!}">
												</div>
												<div class="btn-group" data-toggle="buttons">
													<label class="btn btn-default radio active">
														<input name="userSearchType" value="SELF" checked="checked" type="radio" class="toggle form-filter">[@spring.message code="net.lanelife.casino.cms.web.controller.support.UserSearchFilter.FilterType.SELF"/]
													</label>
													<label class="btn btn-default radio">
														<input name="userSearchType" value="TEAM" type="radio" class="toggle form-filter">[@spring.message code="net.lanelife.casino.cms.web.controller.support.UserSearchFilter.FilterType.TEAM"/]
													</label>
												</div>
											</td>
											<td>
												<input type="text" class="form-control form-filter input-sm" name="search_EQ_billNo" value="${RequestParameters["billNo"]!}">
											</td>
											<td>
												<select name="search_EQ_status" class="form-control form-filter input-sm">
													<option value="">[@spring.message code="datatable.filter.select"/]</option>
		                                            [#list enums["net.lanelife.casino.caipiao.entity.WithdrawRecord$Status"]?values as item]
													<option value="${item.name()}">[@spring.message code="net.lanelife.casino.caipiao.entity.WithdrawRecord.Status."+item.name()/]</option>
													[/#list]
												</select>
											</td>
											<td>
												<div class="margin-bottom-5">
													<input type="text" class="form-control form-filter input-sm" name="search_GTE_amount" placeholder="[@spring.message code="datatable.filter.from"/]"/>
												</div>
												<input type="text" class="form-control form-filter input-sm" name="search_LTE_amount" placeholder="[@spring.message code="datatable.filter.to"/]"/>
											</td>
											<td>
												<div class="margin-bottom-5">
													<input type="text" class="form-control form-filter input-sm" name="search_GTE_fee" placeholder="[@spring.message code="datatable.filter.from"/]"/>
												</div>
												<input type="text" class="form-control form-filter input-sm" name="search_LTE_fee" placeholder="[@spring.message code="datatable.filter.to"/]"/>
											</td>
											<td>
												<input type="text" class="form-control form-filter input-sm" name="search_EQ_payeeBankName">
											</td>
											<td>
												<input type="text" class="form-control form-filter input-sm" name="search_EQ_payeeBranchName">
											</td>
											<td>
												<input type="text" class="form-control form-filter input-sm" name="search_EQ_payeeAccountName">
											</td>
											<td>
												<input type="text" class="form-control form-filter input-sm" name="search_EQ_payeeAccountNo">
											</td>
											<td>
												<input type="text" class="form-control form-filter input-sm" name="search_EQ_payerBankName">
											</td>
											<td>
												<input type="text" class="form-control form-filter input-sm" name="search_EQ_payerAccountName">
											</td>
											<td>
												<input type="text" class="form-control form-filter input-sm" name="search_EQ_payerAccountNo">
											</td>
											<td>
												<div class="input-group date date-picker margin-bottom-5" data-date-format="yyyy-MM-dd HH:mm:ss">
													<input type="text" class="form-control form-filter input-sm" readonly name="search_GTE_createdDate" placeholder="[@spring.message code="datatable.filter.from"/]" value="${RequestParameters["beginCreateDate"]!.now?date+" 00:00:00"}"/>
													<span class="input-group-btn">
														<button class="btn btn-sm default" type="button"><i class="fa fa-calendar"></i></button>
													</span>
												</div>
												<div class="input-group date date-picker" data-date-format="yyyy-MM-dd HH:mm:ss">
													<input type="text" class="form-control form-filter input-sm" readonly name="search_LTE_createdDate" placeholder="[@spring.message code="datatable.filter.to"/]" value="${RequestParameters["endCreateDate"]!.now?date+" 23:59:59"}"/>
													<span class="input-group-btn">
														<button class="btn btn-sm default" type="button"><i class="fa fa-calendar"></i></button>
													</span>
												</div>
											</td>
											<td>
												<div class="input-group date date-picker margin-bottom-5" data-date-format="yyyy-MM-dd HH:mm:ss">
													<input type="text" class="form-control form-filter input-sm" readonly name="search_GTE_handleBeginTime" placeholder="[@spring.message code="datatable.filter.from"/]"/>
													<span class="input-group-btn">
														<button class="btn btn-sm default" type="button"><i class="fa fa-calendar"></i></button>
													</span>
												</div>
												<div class="input-group date date-picker" data-date-format="yyyy-MM-dd HH:mm:ss">
													<input type="text" class="form-control form-filter input-sm" readonly name="search_LTE_handleBeginTime" placeholder="[@spring.message code="datatable.filter.to"/]"/>
													<span class="input-group-btn">
														<button class="btn btn-sm default" type="button"><i class="fa fa-calendar"></i></button>
													</span>
												</div>
											</td>
											<td>
												<div class="input-group date date-picker margin-bottom-5" data-date-format="yyyy-MM-dd HH:mm:ss">
													<input type="text" class="form-control form-filter input-sm" readonly name="search_GTE_handleEndTime" placeholder="[@spring.message code="datatable.filter.from"/]"/>
													<span class="input-group-btn">
														<button class="btn btn-sm default" type="button"><i class="fa fa-calendar"></i></button>
													</span>
												</div>
												<div class="input-group date date-picker" data-date-format="yyyy-MM-dd HH:mm:ss">
													<input type="text" class="form-control form-filter input-sm" readonly name="search_LTE_handleEndTime" placeholder="[@spring.message code="datatable.filter.to"/]"/>
													<span class="input-group-btn">
														<button class="btn btn-sm default" type="button"><i class="fa fa-calendar"></i></button>
													</span>
												</div>
											</td>
											<td>
											
											</td>
											<td>
											
											</td>
											<td>
												<input type="text" class="form-control form-filter input-sm" name="search_EQ_lastModifiedBy">
											</td>
		                                    <td>
												<div class="input-group date date-picker margin-bottom-5" data-date-format="yyyy-MM-dd HH:mm:ss">
													<input type="text" class="form-control form-filter input-sm" readonly name="search_GTE_lastModifiedDate" placeholder="[@spring.message code="datatable.filter.from"/]"/>
													<span class="input-group-btn">
														<button class="btn btn-sm default" type="button"><i class="fa fa-calendar"></i></button>
													</span>
												</div>
												<div class="input-group date date-picker" data-date-format="yyyy-MM-dd HH:mm:ss">
													<input type="text" class="form-control form-filter input-sm" readonly name="search_LTE_lastModifiedDate" placeholder="[@spring.message code="datatable.filter.to"/]"/>
													<span class="input-group-btn">
														<button class="btn btn-sm default" type="button"><i class="fa fa-calendar"></i></button>
													</span>
												</div>
											</td>
											<td>
												<input type="text" class="form-control form-filter input-sm" name="search_LIKE_remark">
											</td>
										</tr>
									</thead>
									<tbody>
									</tbody>
									<tfoot>
										<tr>
		                                	<td style="text-align: center; height: 75px;">[@spring.message code="datatable.footer.aggregate"/]</td>
											<td colspan="20" style="text-align: left;">
												<div style="float: left">
													<div style="color: #c6c6c6">
														<b>[@spring.message code="withdrawrecord.list.datatable.aggregate.pending"/]</b>
														[@spring.message code="withdrawrecord.list.datatable.aggregate.amount"/]<label id="aggregate_amountPending" style="min-width: 120px;"></label>
														[@spring.message code="withdrawrecord.list.datatable.aggregate.fee"/]<label id="aggregate_feePending" style="min-width: 120px;"></label>
														[@spring.message code="withdrawrecord.list.datatable.aggregate.subtotal"/]<label id="aggregate_pending" style="min-width: 120px;"></label>
													</div>
													<div style="color: #dfba49">
														<b>[@spring.message code="withdrawrecord.list.datatable.aggregate.processing"/]</b>
														[@spring.message code="withdrawrecord.list.datatable.aggregate.amount"/]<label id="aggregate_amountProcessing" style="min-width: 120px;"></label>
														[@spring.message code="withdrawrecord.list.datatable.aggregate.fee"/]<label id="aggregate_feeProcessing" style="min-width: 120px;"></label>
														[@spring.message code="withdrawrecord.list.datatable.aggregate.subtotal"/]<label id="aggregate_processing" style="min-width: 120px;"></label>
													</div>
												</div>
												<div style="float: left">
													<div style="color: #45b6af">
														<b>[@spring.message code="withdrawrecord.list.datatable.aggregate.accepted"/]</b>
														[@spring.message code="withdrawrecord.list.datatable.aggregate.amount"/]<label id="aggregate_amountAccepted" style="min-width: 120px;"></label>
														[@spring.message code="withdrawrecord.list.datatable.aggregate.fee"/]<label id="aggregate_feeAccepted" style="min-width: 120px;"></label>
														[@spring.message code="withdrawrecord.list.datatable.aggregate.subtotal"/]<label id="aggregate_accepted" style="min-width: 120px;"></label>
													</div>
													<div style="color: #f3565d">
														<b>[@spring.message code="withdrawrecord.list.datatable.aggregate.rejected"/]</b>
														[@spring.message code="withdrawrecord.list.datatable.aggregate.amount"/]<label id="aggregate_amountRejected" style="min-width: 120px;"></label>
														[@spring.message code="withdrawrecord.list.datatable.aggregate.fee"/]<label id="aggregate_feeRejected" style="min-width: 120px;"></label>
														[@spring.message code="withdrawrecord.list.datatable.aggregate.subtotal"/]<label id="aggregate_rejected" style="min-width: 120px;"></label>
													</div>
												</div>
												<div style="clear: both;">
													<b>[@spring.message code="withdrawrecord.list.datatable.aggregate.total"/]</b>
													[@spring.message code="withdrawrecord.list.datatable.aggregate.amount"/]<label id="aggregate_amount" style="min-width: 120px;"></label>
													[@spring.message code="withdrawrecord.list.datatable.aggregate.fee"/]<label id="aggregate_fee" style="min-width: 120px;"></label>
													[@spring.message code="withdrawrecord.list.datatable.aggregate.subtotal"/]<label id="aggregate_total" style="min-width: 120px;"></label>
												</div>
											</td>
										</tr>
									</tfoot>
								</table>
							</div>
						</div>
					</div>
					<!-- End: life time stats -->
				</div>
			</div>
			<!-- END PAGE CONTENT-->
		</div>
	</div>
	<!-- END CONTENT -->
</div>
<!-- END CONTAINER -->

[#include "../common/foot.html"/]

[#assign path="${ctx}/withdraw-record"/]

<script type="text/javascript">

function diff(d1, d2) {
	var t = d2.getTime() - d1.getTime();
	var days = Math.floor(t/(24*3600*1000));
	t = t % (24*3600*1000);
	var hours = Math.floor(t/(3600*1000));
	t = t % (3600*1000);
	var minutes = Math.floor(t/(60*1000));
	t = t % (60*1000);
	var seconds = Math.floor(t/1000);
	var str = '';
	if (days > 0) str += days + message['date.part.day'];
	if (hours > 0) str += hours + message['date.part.hour'];
	if (minutes > 0) str += minutes + message['date.part.minute'];
	if (seconds > 0) str += seconds + message['date.part.second'];
	return str;
}

jQuery(document).ready(function() {    
    grid.init({
        src: $("#datatable_withdrawrecords"),
        fixedColumns: 1,
        onSuccess: function (data) {
        	var ap = parseFloat($('#aggregate_amountPending').html());
        	var fp = parseFloat($('#aggregate_feePending').html());
        	var ac = parseFloat($('#aggregate_amountProcessing').html());
        	var fc = parseFloat($('#aggregate_feeProcessing').html());
        	var aa = parseFloat($('#aggregate_amountAccepted').html());
        	var fa = parseFloat($('#aggregate_feeAccepted').html());
        	var ar = parseFloat($('#aggregate_amountRejected').html());
        	var fr = parseFloat($('#aggregate_feeRejected').html());
        	$('#aggregate_pending').html((ap + fp).toFixed(2));
        	$('#aggregate_processing').html((ac + fc).toFixed(2));
        	$('#aggregate_accepted').html((aa + fa).toFixed(2));
        	$('#aggregate_rejected').html((ar + fr).toFixed(2));
        	$('#aggregate_amount').html((ap + ac + aa + ar).toFixed(2));
        	$('#aggregate_fee').html((fp + fc + fa + fr).toFixed(2));
        	$('#aggregate_total').html((ap + fp + ac + fc + aa + fa + ar + fr).toFixed(2));
        },
        onError: function (data) { },
        dataTable: {
            "pageLength": 10,
            "ajax": {"url": "${path}"},
            "columnDefs": [{'orderable': false, 'targets': [0]}],
            "columns": [
                {"data": "id", "render": function(data,type,full) {
                	return '<div class="btn-group">'+
							'	<a href="#" class="btn yellow btn-xs btn-operation" style="width:40px">' + '稽查' + '</a>'+
							'	<a href="#" class="btn blue btn-xs btn-operation" style="width:40px">' + '帐变' + '</a>'+
							'	<a href="#" class="btn green btn-xs btn-operation" style="width:40px">' + '出款' + '</a>'+
							'	<a href="#" class="btn red btn-xs btn-operation" style="width:40px">' + '拒绝' + '</a>'+
							'</div>';
				}},
                {"data": "userName"},
                {"data": "billNo"},
                {"data": "status", "render": function(data,type,full) {
                	switch (data) {
					case 'PENDING':
						return '<span class="label label-sm label-default">' + message['net.lanelife.casino.caipiao.entity.WithdrawRecord.Status.PENDING'] + '</span>';
					case 'PROCESSING':
						return '<span class="label label-sm label-warning">' + message['net.lanelife.casino.caipiao.entity.WithdrawRecord.Status.PROCESSING'] + '</span>';
					case 'ACCEPTED':
						return '<span class="label label-sm label-success">' + message['net.lanelife.casino.caipiao.entity.WithdrawRecord.Status.ACCEPTED'] + '</span>';
					case 'REJECTED':
						return '<span class="label label-sm label-danger">' + message['net.lanelife.casino.caipiao.entity.WithdrawRecord.Status.REJECTED'] + '</span>';
					}
				}},
				
                {"data": "amount", "class": "right"},
                {"data": "fee", "class": "right"},
                
                {"data": "payeeBankName"},
                {"data": "payeeBranchName"},
                {"data": "payeeAccountName"},
                {"data": "payeeAccountNo"},
                {"data": "payerBankName"},
                {"data": "payerAccountName"},
                {"data": "payerAccountNo"},
				
				{"data": "createdDate"},
				{"data": "handleBeginTime"},
				{"data": "handleEndTime"},
				{"render": function(data,type,full) {
					if (full.handleBeginTime == null || full.handleEndTime == null) return '';
					return diff(new Date(full.handleBeginTime.replace(/-/gi,'/')), new Date(full.handleEndTime.replace(/-/gi,'/')));
				}},
				{"render": function(data,type,full) {
					if (full.handleEndTime == null) return '';
					return diff(new Date(full.createdDate.replace(/-/gi,'/')), new Date(full.handleEndTime.replace(/-/gi,'/')));
				}},
				{"data": "lastModifiedBy"},
				{"data": "lastModifiedDate"},
				{"data": "remark"}
            ],
            "rowCallback": function(row, data) {
            	switch (data.status) {
				case 'PENDING':
					$(row).addClass("default");
					break;
				case 'PROCESSING':
					$(row).addClass("warning");
					break;
				case 'ACCEPTED':
					$(row).addClass("success");
					break;
				case 'REJECTED':
					$(row).addClass("danger");
					break;
				}
            },
            "order": [
                [13, "desc"]
            ]
        }
    });
});
</script>

</body>
<!-- END BODY -->
</html>